#ifndef __SMS_LISTVIEW__
#define __SMS_LISTVIEW__

#include <goocanvas.h>

#include "theme.h"

typedef enum _LISTVIEW_TYPE{
	LISTVIEW_NONE,
    LISTVIEW_ICON
}Listview_type;

typedef struct _NODE{
	GdkPixbuf *node_pixbuf;
	GdkPixbuf *node_pixbuf_fg;
	char *node_buf;
	gpointer private;
}Node;

typedef struct _ListView
{
	GooCanvasItem *parent;
	GooCanvasItem *cavas;
	GooCanvasItem *frame;
	GooCanvasItem *group;
	GooCanvasItem *background;
	GooCanvasItem *highlight;
	
	GooCanvasItem **text;
	GooCanvasItem **icon;
	
	gdouble x;
	gdouble y;
	gdouble w;
	gdouble h;
	gdouble fw;

	int view_cur;
	int view_count;
	int list_cur;
	int list_count;

	GList* items;
	Theme * theme;

	gboolean (*free_node_private)(struct _ListView *lv,gpointer data);
}ListView;

ListView *listview_new(GooCanvasItem *parent,gdouble x,gdouble y,Theme * theme,Listview_type lt);
gboolean listview_change_frame_pic(ListView *lv,GdkPixbuf *pixbuf);
gboolean listview_change_background_pic(ListView *lv,GdkPixbuf *pixbuf);
gboolean listview_change_highlight_pic(ListView *lv,GdkPixbuf *pixbuf);
gboolean listview_add_item(ListView *lv,Node *item);
Node * listview_item_create(GdkPixbuf *bg,GdkPixbuf *fg,const char *text,gpointer data);
void listview_item_destroy(ListView *lv,Node *item);
Node * listview_get_cur_item(ListView *lv);
gboolean listview_translate(ListView *lv,int translate);
gboolean listview_set_items_text(ListView *lv,int id,const char *text);
const char *listview_get_items_text(ListView *lv,int id);
gboolean listview_set_items_icon(ListView *lv,int id,GdkPixbuf *pixbuf);
gboolean listview_list_init(ListView *lv);
void listview_set_func(ListView *lv,const char *key,gboolean (*func)(ListView *lv,gpointer data));
void listview_destroy(ListView *lv);
Theme *listview_change_theme(Theme *theme,GdkPixbuf *pixbuf_frame,GdkPixbuf *pixbuf_bg,
							GdkPixbuf *pixbuf_lfg, GdkPixbuf *pixbuf_icon);
void listview_highlight_translate(ListView *lv,int translate);
void listview_set_to(ListView *lv,int id);
int listview_get_cur_item_id(ListView *lv);
void listview_set_pic(gpointer object,GdkPixbuf *pic);
#endif
